#.爬取三创官网的所有图片

import re
import requests

# 发送HTTP请求，获取网页内容
url = "https://www.sanchuangedu.cn/"
response = requests.get(url)
html_content = response.text

# 使用正则表达式匹配图片URL
image_urls = re.findall(r'<img\s+src=([^"\'>\s]+)', html_content)

print(image_urls)
# 打印匹配到的图片URL
for image_url in image_urls:
    print(image_url)
    print_url = url+image_url
    response = requests.get(print_url)

    # 检查响应状态码
    if response.status_code == 200:
        # 将图片内容保存到文件
        with open(image_url, "wb") as file:
            file.write(response.content)





